<template>
  <div class="common-layout">
    <el-container>
      <el-header v-if="showSidebarAndHeader">
        <Header></Header>
      </el-header>
      <el-container>
        <el-aside v-if="showSidebarAndHeader" width="200px"><Sidebar></Sidebar></el-aside>
        <el-main><Main></Main></el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import Header from './components/Header.vue';
import Main from './components/Main.vue';
import Sidebar from './components/Sidebar.vue';

export default {
  components: {
    Sidebar,
    Header,
    Main
  },
  setup() {
    const route = useRoute();
    const showSidebarAndHeader = computed(() => {
      return (route.path !== '/Register' && route.path !== '/' &&route.path.toLowerCase() !== '/register' && route.path !== '/confirm' && route.path !== '/reset');
    });

    return {
      showSidebarAndHeader
    };
  }
};
</script>

<style>
body, html, #app {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: Avenir, Helvetica, Arial, sans-serif;
}
.el-container {
  height: 100%;
}
.el-header, .el-main, .el-aside {
  height: 100%;
}
</style>
